---
hide_table_of_contents: true
---

import CodeBlock from "@theme/CodeBlock";

# Combined memory

It is also possible to use multiple memory classes in the same chain. To combine multiple memory classes, we can initialize the `CombinedMemory` class, and then use that.

import TextExample from "@examples/memory/combined.ts";

import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";

<IntegrationInstallTooltip></IntegrationInstallTooltip>

```bash npm2yarn
npm install @langchain/openai
```

<CodeBlock language="typescript">{TextExample}</CodeBlock>
